<?php

class Application_Form_PermissionChoiceForm extends Zend_Form {

	public function init() {
		$session = new Zend_Session_Namespace("codebar");
		$this->setName('permissionchoice');

		$id = new Zend_Form_Element_Hidden('id');
		$id->setDecorators(array('ViewHelper'));
		$permissions = $session->permissions;
		$champs=array($id);
		foreach($permissions as $p)
		{
			$button = new Zend_Form_Element_Submit($p['nom']);
			$button->setLabel($p['label']);
			if($p['nom'] == 'PrixProduit' || $p['nom'] == 'GestionGroupe')
			{
				$button->setAttrib('class','admin_button')
				->setDecorators(array('ViewHelper'));
			}
			else
			{
				$button->setAttrib('class','button')
				->setDecorators(array('ViewHelper'));
			}
			$this->addElement($button);
		}

	}

}